<?php
	$cart=$this->session->userdata('Cart');
?>
<ul class="block_cart">
	<?php
		if($cart){
			$shop=rtrim($cart['shop'],'|');
			$arrShop=explode('|',$shop);
			//print_r($arrShop);
			$n=count($arrShop);
			$prcie_all='';
			for($i=0;$i<$n;$i++){
				$arrTmp=explode(',',$arrShop[$i]);
				$result=$this->productsModel->getOne($arrTmp[0]);
				if($result[0]->price_new !=0 && $result[0]->promotion !=0){
					$price=$result[0]->price_new * $arrTmp[1];
				}else{
					$price=$result[0]->price_old * $arrTmp[1];
				}
				$prcie_all +=$price;
				//print_r($result);exit;			
	?>
    <li id="productID_<?=$arrTmp[0]?>">
        <span><?=$arrTmp[1];?> x</span>
        <a href="<?=PATH_URL.'san-pham/chi-tiet/'.$arrTmp[0].''?>"><?=$result[0]->title;?></a>
        <b><?=number_format($price,0,',','.');?> vnđ</b>
        <img onclick="delCart(<?=$arrTmp[0]?>);" src="<?=PATH_URL.'static/'?>images/delete.png" />
    </li>
    <?php }} else{?>
    <li>Bạn chưa có sản phẩm nào hết</li>
    <?php }?>
</ul>

<?php if($cart):?><h4>Tổng cộng: <span><?=number_format($prcie_all,0,',','.');?> vnđ </span></h4>
<h3><a href="<?=PATH_URL.'gio-hang'?>">Thanh toán</a></h3><?php endif;?>